using huqiang.Core.HGUI;
using huqiang.UIModel;
using UnityEngine;

public class DrawPage : UIPage
{
    DrawPageView view;
    public override void Initial(UIElement parent, object dat = null)
    {
        base.Initial(parent, dat);
        LoadUI("DrawPage");
        view = new DrawPageView();
       
        InitialEvent();
    }
    void InitialEvent()
    {
        view.Paint.BrushColor = Color.black;
        view.Paint.BrushSize = 36;
        view.Palette.TemplateChanged =
        view.Palette.ColorChanged = (o) =>
        {
            view.color.color = o.SelectColor;
            view.Paint.BrushColor = o.SelectColor;
        };
        view.PaintSize.OnValueChanged = (o) =>
        {
            var v = o.Percentage * 36;
            if (v < 1)
                v = 1;
            view.size.text = v.ToString();
            view.Paint.BrushSize = v;
        };
        view.Last.Click = (o, e) => {
            LoadPage<StartPage>();
        };
        view.Next.Click = (o, e) => {
            LoadPage<DatePage>();
        };
    }
}